home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / BASFILES.LZH / DIALOG2.BAS < prev    next >
BASIC Source File  |  1988-09-10  |  4KB  |  158 lines

  1. '$INCLUDE:'QBTOOLS.INC'
  2. '' '$INCLUDE: 'QBTOOLS2.INC'
  3.  
  4. 'DIM Ques$(10)
  5.  
  6. 'Ques$(1) = "This is a test to see how the"
  7. 'Ques$(2) = "dialog box works. The next line is the input."
  8. 'Ques$(3) = "It is important to see how this follows on from the"
  9. 'Ques$(4) = "input. Both these lines, and those before hand"
  10. 'Ques$(5) = "should be left justified."
  11. 'Ques$(6) = "Heres More"
  12. 'Ques$(7) = "Heres More again"
  13. 'Ques$(8) = "After"
  14.  
  15. 'First% = 2
  16. 'Second% = 3
  17. 'Third% = 3
  18. '
  19. 'sect% = 1
  20. '
  21. 'Ffgd% = 7
  22. 'Fbgd% = 0
  23. 'Gfgd% = 7
  24. 'Gbgd% = 0
  25. '
  26. 'Length1% = 22
  27. 'Length2% = 17
  28. '
  29. 'FOR sect% = 0 TO 2
  30. '   DoubleDialog Ques$(), First%, Second%, Third%, Length1%, Length2%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer1$, Answer2$, Ek%
  31. 'NEXT sect%
  32. '
  33. 'END
  34.  
  35. SUB DoubleDialog (Ques$(), First%, second%, Third%, Length1%, Length2%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer1$, Answer2$, Ek%)
  36.  
  37.  
  38.     '  First    -  Textlines before the first question
  39.     '  Second   -  Textlines between the two questions
  40.     '  Third    -  Textlines after the second question
  41.     '  Length1  -  Length of input #1
  42.     '  Length2  -  Length of input #2
  43.     '  Ffgd     -  Frame foreground
  44.     '  Fbgd     -  Frame background
  45.     '  Gfgd     -  General Foreground
  46.     '  Gbgd     -  General background
  47.     '  Sect     -  Section of the screen to display on
  48.     '              0=Top,1=Center,2=Bottom
  49.     '  Answer1  -  Answer string #1
  50.     '  Answer2  -  Answer string #2
  51.     '  Ek       -  Exit Key
  52.     '              5=Return, 7=ESC
  53.     '$DYNAMIC
  54.     REDIM Saver%(2000)
  55.  
  56.     BandA% = First% + second% + Third%
  57.  
  58.     height% = BandA%                    '  Pure Text height
  59.     height% = height% + 8               '  6 lines of drawing + 2 input lines
  60.  
  61.     IF height% > 25 THEN
  62.         EXIT SUB
  63.     END IF
  64.  
  65.     IF Length1% < 1 THEN
  66.         EXIT SUB
  67.     END IF
  68.  
  69.     IF Length2% < 1 THEN
  70.         EXIT SUB
  71.     END IF
  72.  
  73.     SELECT CASE sect%
  74.         CASE 0
  75.             Begin% = 1
  76.         CASE 1
  77.             Begin% = (25 - height%) / 2
  78.         CASE 2
  79.             Begin% = (25 - height%) + 1
  80.         CASE ELSE
  81.             EXIT SUB
  82.     END SELECT
  83.  
  84.     SaveScreen Saver%(1)
  85.  
  86.     Txwd% = Length1%
  87.     IF Length2% > Txwd% THEN
  88.         Txwd% = Length2%
  89.     END IF
  90.  
  91.     FOR j% = 1 TO BandA%
  92.         Trim Ques$(j%)
  93.         IF LEN(Ques$(j%)) > Txwd% THEN
  94.             Txwd% = LEN(Ques$(j%))
  95.         END IF
  96.     NEXT j%
  97.  
  98.     BoxWidth% = Txwd% + 4
  99.     LeftCol% = (80 - BoxWidth%) / 2
  100.     Wid% = BoxWidth%
  101.     FrameType% = 3
  102.     FrmFgd% = Ffgd%
  103.     FrmBgd% = Fbgd%
  104.     Fill% = 1
  105.     FillFgd% = Gfgd%
  106.     FillBgd% = Gbgd%
  107.  
  108.     DrawBox Begin%, LeftCol%, Wid%, height%, FrameType%, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  109.  
  110.     Attrib1% = Attributes%(Gfgd%, Gbgd%, 0, 0)
  111.     Attrib2% = Attributes%(Ffgd%, Fbgd%, 0, 0)
  112.  
  113.     FOR j% = 1 TO First%
  114.         text$ = Ques$(j%)
  115.         ColorPrint text$, Begin% + j%, LeftCol% + 2, Attrib1%
  116.     NEXT j%
  117.  
  118.     FOR j% = 1 TO second%
  119.         text$ = Ques$(j% + First%)
  120.         ColorPrint text$, Begin% + First% + 3 + j%, LeftCol% + 2, Attrib1%
  121.     NEXT j%
  122.  
  123.     FOR j% = 1 TO Third%
  124.         text$ = Ques$(j% + First% + second%)
  125.         ColorPrint text$, Begin% + First% + second% + 6 + j%, LeftCol% + 2, Attrib1%
  126.     NEXT j%
  127.  
  128.     Istart1% = (80 - Length1%) / 2
  129.     Istart2% = (80 - Length2%) / 2
  130.  
  131.     DrawBox Begin% + First% + 1, Istart1% - 1, Length1% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  132.     DrawBox Begin% + First% + second% + 4, Istart2% - 1, Length2% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  133.  
  134.     DO
  135.  
  136.         Xc% = LeftCol% + 2
  137.         Yc% = Begin% + First% + 2
  138.         TextInput 0, 0, 0, 0, 1, 1, 1, Length1%, Answer1$, Istart1%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
  139.  
  140.         IF Ek% <> 6 THEN
  141.             EXIT DO
  142.         END IF
  143.  
  144.         Xc% = LeftCol% + 2
  145.         Yc% = Begin% + First% + second% + 5
  146.         TextInput 0, 0, 0, 0, 1, 1, 1, Length2%, Answer2$, Istart2%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
  147.       
  148.         IF Ek% <> 6 THEN
  149.             EXIT DO
  150.         END IF
  151.  
  152.     LOOP
  153.  
  154.     RestoreScreen Saver%(1)
  155.  
  156. END SUB
  157.  
  158.